//
//  TypeCollectionViewCell.m
//  Journey
//
//  Created by dllo on 16/5/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TypeCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation TypeCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self ) {
        [self createType];
    }
    return self;
}

-(void)createType{
    self.photo = [[UIImageView alloc] init];
   // self.photo.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.photo];
    
    self.nameLabel = [[UILabel alloc] init];
  //  self.nameLabel.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.nameLabel];
    
    
    self.descriptionLabel = [[UILabel alloc] init];
 //   self.descriptionLabel.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.descriptionLabel];
    
    self.totalLabel = [[UILabel alloc] init];
 //   self.totalLabel.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.totalLabel];
    
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.photo.frame = CGRectMake(10 * WIDTHC, 20 * WIDTHC, 80 * WIDTHC, 60 * WIDTHC);
    self.nameLabel.frame = CGRectMake(100 * WIDTHC, 20 * WIDTHC, 80 * WIDTHC, 30 * WIDTHC);
    self.descriptionLabel.frame = CGRectMake(100 * WIDTHC, 50 * WIDTHC, 150 * WIDTHC, 30 * WIDTHC);
    self.totalLabel.frame = CGRectMake(200 * WIDTHC, 20 * WIDTHC, 80 * WIDTHC, 30 * WIDTHC);
    
}


-(void)setGroup:(groupModel *)group{
    _group = group;
    
    [self.photo sd_setImageWithURL:[NSURL URLWithString:group.photo]];
    self.nameLabel.text = group.name;
    self.descriptionLabel.text = group.descrip;
    self.totalLabel.text = group.total_threads;
    
}




@end
